package com.qf.day03.loop;

/**
 * 案例：从1加到100，输出和大于888的那个数
 */
public class Demo01 {

    public static void main(String[] args) {

        int sum = 0;
        for (int i = 1; i <=100 ; i++) {
            sum = sum+i;
            if (sum>888){
                System.out.println(i);
                // 退出循环
                break;
            }
        }

        System.out.println("sum="+sum);

    }

}
